import java.util.ArrayList;

public class InputProcessing {

	public InputProcessing() {

	}

	// Setting FDs
	public ArrayList<FuncDep> setFD(String text) {
		ArrayList<FuncDep> FD = new ArrayList<FuncDep>();
		String[] input = text.trim().split(";");
		String from;
		String to;

		for (int i = 0; i < input.length; i++) {
			if (input[i].length() > 0) {
				from = input[i].split("->")[0].trim();
				to = input[i].split("->")[1].trim();
				FD.add(new FuncDep(from, to));
			}
		}

		return FD;
	}

	// Setting Null free Subschema
	public ArrayList<String> setNullFreeSubSchema(String text) {
		String[] input = text.trim().split(" ");
		ArrayList<String> R_s = new ArrayList<String>();

		for (int i = 0; i < input.length; i++) {
			if (input[i].length() > 0) {
				R_s.add(input[i].trim());
			}
		}

		return R_s;
	}

	// Get attributes
	public ArrayList<String> getAttributes(String text) {
		String[] input = text.trim().split(" ");
		ArrayList<String> R = new ArrayList<String>();

		for (int i = 0; i < input.length; i++) {
			if (input[i].length() > 0) {
				R.add(input[i].trim());
			}
		}

		return R;
	}
}
